@import '../style/theme/color';
@import '../style/theme/shadow';
@import '../style/theme/corner';
@import '../style/core/_font';
@import '../style/core/animation';
@import '../style/theme/z-index';

:host {
  display: block;
  outline: none;
}

.devui-tags-host {
  position: relative;
  height: 100%;
  outline: none;

  &:active {
    outline: 0;
  }
}

.devui-tags {
  -moz-appearance: textfield;
  -webkit-appearance: textfield;
  padding: 2px 4px;
  overflow: hidden;
  word-wrap: break-word;
  cursor: text;
  background-color: $devui-base-bg;
  border: 1px solid $devui-line;
  border-radius: $devui-border-radius;
  height: 100%;

  &:hover {
    border-color: $devui-list-item-hover-bg;
  }

  &.focused {
    outline: 0;
  }

  &.devui-dropdown-origin:focus-within {
    border-color: $devui-brand;
  }

  .devui-tag-list {
    margin: 0;
    padding: 0;
    list-style-type: none;
  }

  .devui-tag-item {
    margin: 1px;
    padding: 0 10px;
    display: inline-block;
    min-height: 18px;
    line-height: 18px;
    border-radius: $devui-border-radius;
    color: $devui-text;
    background-color: $devui-label-bg;
    position: relative;
    border: 1px solid $devui-label-bg;

    span {
      line-height: 1.5;
      margin-right: 25px;
    }

    .remove-button {
      margin: 0 0 0 12px;
      padding: 0;
      border: none;
      vertical-align: top;
      font-size: $devui-font-size-page-title;
      border-radius: 50%;
      background-color: $devui-line;
      width: 12px;
      height: 12px;
      display: inline-block;
      line-height: 12px;
      text-align: center;
      transform: translateY(-50%);
      position: absolute;
      top: 50%;
      right: 10px;

      svg path {
        fill: $devui-light-text; //TODO: Color-Question
      }

      &:hover {
        text-decoration: none;
      }
    }
  }

  &:not(.devui-disabled) {
    .devui-tag-item {
      cursor: pointer;

      span {
        &:hover {
          color: $devui-list-item-hover-text;
        }
      }

      .remove-button {
        &:hover {
          background-color: $devui-list-item-hover-text;
        }
      }
    }
  }

  &.devui-disabled {
    border-color: $devui-disabled-line;
    background-color: $devui-disabled-bg;
    cursor: not-allowed;

    .devui-tag-item {
      color: $devui-disabled-text;
      background-color: $devui-disabled-bg;
      border-color: $devui-disabled-line;

      span {
        margin-right: 0;
      }

      .remove-button {
        background-color: $devui-disabled-line;

        svg path {
          fill: $devui-light-text;
        }
      }
    }

    .devui-tag-list {
      min-height: 22px;
    }
  }

  input.devui-input {
    border: 0;
    outline: 0;
    float: left;
    width: 100%;
    height: 22px;
    font-size: $devui-font-size;
    padding-left: 5px;

    &::-ms-clear {
      display: none;
    }
  }
}

.devui-tags-autocomplete {
  position: absolute;
  padding-bottom: 5px;
  z-index: $devui-z-index-dropdown;
  width: 100%;
  background-color: $devui-connected-overlay-bg;
  box-shadow: $devui-shadow-length-connected-overlay $devui-shadow;

  &.devui-dropdown-menu {
    display: block;
  }

  .devui-suggestion-list {
    margin: 0;
    padding: 0;
    list-style-type: none;
    max-height: 280px;
    overflow-y: auto;
    position: relative;

    .devui-suggestion-item {
      padding: 5px 10px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: $devui-font-size;
      line-height: 20px;

      &:not(.devui-disabled) {
        cursor: pointer;
        color: $devui-text;
        // background-color: $devui-base-bg;
        &:hover {
          background-color: $devui-list-item-hover-bg;
        }

        &.selected {
          color: $devui-brand;
          background-color: $devui-list-item-hover-bg;
        }
      }
    }
  }
}

.devui-tags-autocomplete {
  .devui-suggestion-list {
    .devui-suggestion-item {
      transition: color $devui-animation-duration-fast $devui-animation-ease-in-smooth, background-color $devui-animation-duration-fast $devui-animation-ease-in-smooth;
    }
  }
}
